﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Finbook.GameApp.Models.V5
{
    public abstract class RoleV5
    {
        public RoleV5(int hp)
        {
            HP = hp;
            MaxHP = hp;
            Skills = new List<SkillV5>();
        }
        public int HP { get; set; }
        public int MaxHP { get; set; }
        public List<SkillV5> Skills { get; set; }

        public virtual void BeHit(SkillV5 skill)
        {
            switch (skill.SkillType)
            {
                case SkillType.Damage:
                    HP -= skill.SkillDamage;
                    HP = HP <= 0 ? 0 : HP;
                    Console.WriteLine($"被攻击，受到伤害{skill.SkillDamage},当前血量{HP}");
                    break;
                case SkillType.Heal:
                    HP += skill.Heal;
                    HP = HP >= MaxHP ? MaxHP : HP;
                    Console.WriteLine($"释放治疗术，加血{skill.Heal},当前血量{HP}");
                    break;
                case SkillType.State:
                    break;
                default:
                    break;
            }
        }


        public abstract SkillV5 SelectSkill();

        public RoleV5 GetSkillTarget(SkillType type,RoleV5 to)
        {
            switch (type)
            {
                case SkillType.Damage:
                    return to;
                case SkillType.Heal:
                    return this;
                case SkillType.State:
                    return this;
                default:
                    return this;
            }
        }
    }
}
